package com.soft.cake.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.soft.cake.mapper.AdminMapper;
import com.soft.cake.pojo.Admin;
import com.soft.cake.service.IAdminService;

/**
 * @author RexALun
 * @date Aug 20, 2019 8:25:18 PM
 * @version 1.0.0
 * @TODO 
 */
@Service
public class AdminServiceImpl implements IAdminService {

	@Autowired
	private AdminMapper adminMapper; 
	/**
	 * @Description: check admin is vaild 
	 * @param admin
	 * @return
	 * @see com.soft.cake.service.IAdminService#checkVaildAdmin(com.soft.cake.pojo.Admin)
	 */
	@Override
	public boolean checkVaildAdmin(Admin admin) {
		Admin resAdmin = adminMapper.selectByUsername(admin.getAdminUsername());
		if(resAdmin == null) {
			return false;
		}
		if(resAdmin.getAdminPassword().equals(admin.getAdminPassword())) {
			return true;
		}
		// TODO Auto-generated method
		return false;
	}

}
